﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EyeOpen.Validation.Entities.HardCodedValidation
{
    /// <summary>
    /// Represents a concrete hard coded validator.
    /// </summary>
    public class HardCodedValidator : IEntityValidator
    {
        #region IEntityValidator Members
        public bool IsValid<T>(object item)
        {
            if (typeof(T) == typeof(Person))
            {
                return PersonValidator.IsValid((Person)item);
            }
            else
                throw new NotSupportedException();
        }
        #endregion
    }

    internal static class PersonValidator {
        public static bool IsValid(Person person) {            
            return (!string.IsNullOrEmpty(person.Name));        
        }    
    }
}
